package org.redmagic.ui;

import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;

public class UiPropertyListResponse {

	private static final String FAILED_RESULT = "ERROR";
	private static final String SUCCESS_RESULT = "OK";

	public static UiPropertyListResponse getFailedResponse(String message) {
		return new UiPropertyListResponse(FAILED_RESULT, null, message);
	}
	
	public static UiPropertyListResponse getSuccessResponse(List<UiProperty> records) {
		return new UiPropertyListResponse(SUCCESS_RESULT, records, null);
	}
	
	private final String result;
	private final List<UiProperty> records;
	private final String message;

	private UiPropertyListResponse(String result, List<UiProperty> records, String message) {
		this.result = result;
		this.records = records;
		this.message = message;
	}

	@JsonProperty("Result")
	public String getResult() {
		return result;
	}

	@JsonProperty("Records")
	public List<UiProperty> getRecords() {
		return records;
	}

	@JsonProperty("Message")
	public String getMessage() {
		return message;
	}
}